import BasicController from './../../BasicController'
import InternalTypeModel from '../../../model/basic/logistics/InternalTypeModel'
import ErrorHandlerCode from './../../../util/ErrorHandlerCode'

class InternalTypeController extends BasicController{
    insert(req, res){
        InternalTypeModel.insert(req.body).then((data) => {
            super.RequestSuccessMsg(res, data);
        }).catch((err) => {
            res.json(ErrorHandlerCode.INNERSERVICERROR);
            throw err;
        })
    }
    updateRecord(req, res){
        InternalTypeModel.update(req.body).then((data) => {
            super.RequestSuccessMsg(res, data);
        }).catch((err) => {
            res.json(ErrorHandlerCode.INNERSERVICERROR);
            throw err;
        })
    }
    deleteById(req, res){
        InternalTypeModel.delete(req.body.id).then((data) => {
            super.RequestSuccessMsg(res, data);
        }).catch((err) => {
            res.json(ErrorHandlerCode.INNERSERVICERROR);
            throw err;
        })
    }
    findById(req, res){
        InternalTypeModel.findById(req.body.id).then((data) => {
            super.RequestSuccessMsg(res, data);
        }).catch((err) => {
            res.json(ErrorHandlerCode.INNERSERVICERROR);
            throw err;
        })
    }
    findAll(req, res){
        InternalTypeModel.findAll().then((data) => {
            super.RequestSuccessMsg(res, data);
        }).catch((err) => {
            res.json(ErrorHandlerCode.INNERSERVICERROR);
            throw err;
        })
    }
}

module.exports = new InternalTypeController();